package sequences;

/**
 * A simple character sequence based on modular arithmetic.
 * 
 * @author John Schaeffer
 *
 */
public class ModSequence implements CharSequence {

    private int modulus;
    private int time;
    
    /**
     * Creates a modular character sequence with the given modulus under 26.
     * 
     * @param modulus The modulus to be used.
     */
    public ModSequence(int modulus) {
        this.modulus = modulus;
        this.time = 0;
    }
    
    public char nextChar() {
        
        char rtn = (char)('A' + time);
        
        time = (time + 1) % modulus;
        
        return rtn;
    }
}
